home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / HDX_BACK / HDX401.ATB / BAHDI.S < prev    next >
Encoding:
Text File  |  2001-02-09  |  13.4 KB  |  637 lines

  1. * bahdi.s - use for testing to return bad blocks.
  2.  
  3. *------------------------------------------------------------------------
  4. *                                    :
  5. *    ST SASI/AHDI hard disk driver                    :
  6. *    Copyright 1985 Atari Corp.                    :
  7. *                                    :
  8. *----                                    :
  9.  
  10. etv_critic    equ    $404        ; critical error handoff vector
  11. phystop        equ    $42e        ; physical top of memory
  12. flock        equ    $43e        ; FIFO lock variable
  13. _bootdev    equ    $446        ; default boot device
  14. _hz_200        equ    $4ba        ; system 200hz timer
  15. hdv_init    equ    $46a        ; hdv_init()
  16. hdv_bpb        equ    $472        ; hdv_bpb(dev)
  17. hdv_rw        equ    $476        ; hdv_rw(rw, buf, count, recno, dev)
  18. hdv_boot    equ    $47a        ; hdv_boot()
  19. hdv_mediach    equ    $47e        ; hdv_mediach(dev)
  20. _drvbits    equ    $4c2        ; block device bitVector
  21. _dskbufp    equ    $4c6        ; pointer to common disk buffer
  22. pun_ptr        equ    $516        ; pointer to physical unit table
  23.  
  24. maxunits    equ    16        ; maximum number of units
  25. nretries    equ    3        ; #retries-1
  26.  
  27. MAXSECTORS    equ    254        ; maximum number of sectors at one gulp
  28.  
  29. EWRITF        equ    -10        ; GEMDOS error codes
  30. EREADF        equ    -11
  31. CRITRETRY    equ    $00010000    ; "retry" return code
  32.  
  33. * ---------------- Low-level driver ----------------
  34.  
  35.  
  36. *----- Hardware:
  37. wdc        equ    $ffff8604
  38. wdl        equ    $ffff8606
  39. wdcwdl        equ    wdc        ; used for long writes
  40. xwdl        equ    wdl-wdc        ; offset from wdc to wdl
  41.  
  42. dmahi        equ    $ffff8609
  43. dmamid        equ    dmahi+2
  44. dmalow        equ    dmamid+2
  45. gpip        equ    $fffffa01
  46.  
  47.  
  48. *----- Tunable:
  49. ltimeout        equ    450000        ; long-timeout (3 S)
  50. stimeout        equ    15000        ; short-timeout (100 mS)
  51.  
  52. tocount:    dc.l    1
  53. *+
  54. * LONG _qdone() - Wait for command byte handshake
  55. * LONG _fdone() - Wait for operation complete
  56. * Passed:    nothing
  57. *
  58. * Returns:    EQ: no timeout
  59. *        MI: timeout condition
  60. *
  61. * Uses:        D0
  62. *
  63. * each pass through the loop takes 6.75 uS
  64. *-
  65. _fdone:    move.l    #ltimeout,tocount
  66.     bra    qd1
  67.  
  68. _qdone:
  69.     move.l    #stimeout,tocount
  70. qd1:    subq.l    #1,tocount        ; drop timeout count
  71.     bmi    qdq            ; (i give up, return NE)
  72.     btst    #5,gpip            ; interrupt?
  73.     bne    qd1            ; (not yet)
  74.  
  75.     moveq    #0,d0            ; return EQ (no timeout)
  76.     rts
  77.  
  78. qdq:    moveq    #-1,d0
  79.     rts
  80.  
  81.  
  82. *+
  83. * WORD _endcmd()
  84. * Wait for end of SASI command
  85. * Passed:    d0 value to be written to wdl
  86. *
  87. * Returns:    EQ: success (error code in D0.W)
  88. *        MI: timeout
  89. *        NE: failure (SASI error code in D0.W)
  90. *
  91. * Uses:        d0,d1
  92. *-
  93. _endcmd: move    d0,d1            ; preserve wdl value
  94.  
  95.     bsr    _fdone            ; wait for operation complete
  96.     bmi    endce            ; (timed-out, so complain)
  97.  
  98.     move.w    d1,wdl
  99.     nop
  100.     move.w    wdc,d0            ; get the result
  101.     and.w    #$00ff,d0        ; (clean it up), if non-zero should
  102.  
  103. endce:    rts                ;  do a ReadSense command to learn more
  104.  
  105. *-
  106. * _hread(sectno, count, buf, dev)
  107. * LONG sectno;         4(sp)
  108. * WORD count;         8(sp)
  109. * LONG buf;        $a(sp)    $b=high, $c=mid, $d=low
  110. * WORD dev;        $e(sp)
  111. *
  112. * Returns:    -1 on timeout
  113. *        0 on success
  114. *        nonzero on error
  115. *
  116. *-
  117.     .globl    _hread
  118. _hread:
  119.     movea.l    #wdc,a0            ; pointer to DMA chip
  120.     st    flock            ; lock FIFO
  121.  
  122.  
  123.  
  124. * *B*A*D* * * * * * * * * * * * * * * * * * * * * * * * * * 
  125.  
  126. badblk0        equ    $283e        ; bad block start sector 0
  127. badblk1        equ    $c91e        ; bad block start sector 1
  128. badblk2        equ    $c856        ; bad block start sector 2
  129.  
  130. badroot        equ    $ffffff        ; bad root sector
  131. baddeft        equ    $ffffff        ; bad defect sector
  132. badboot        equ    $ffffff        ; bad boot sector
  133. badfat1        equ    $ffffff        ; bad number 1 FAT
  134. badfat2        equ    $ffffff        ; bad number 2 FAT
  135. badrdir        equ    $ffffff        ; bad root directory
  136. badsec0        equ    $283f        ; rogue bad sector 0 (D: of 5 Mb)
  137. badsec1        equ    $c92c        ; rogue bad sector 1 (G: of 16 Mb)
  138. badsec2        equ    $c8de        ; rogue bad sector 2 (H: of 1.3 Mb)
  139. badwrit        equ    $ffffff        ; bad write sector
  140.  
  141. badmin        equ    $ffffff        ; bad sector range minimum
  142. badmax        equ    $ffffff        ; bad sector range maximum
  143.  
  144.     move.w    8(sp),d0
  145.     cmpi.w    #1,d0
  146.     beq    ootka
  147.     move.l    4(sp),d0
  148.     andi.l    #$001fffff,d0
  149.     cmpi.l    #badblk0,d0
  150.     beq    baad
  151.     cmpi.l    #badblk1,d0
  152.     beq    baad
  153.     cmpi.l    #badblk2,d0
  154.     beq    baad
  155.     bra    good
  156.  
  157. ootka:    move.l    4(sp),d0
  158.     andi.l    #$001fffff,d0
  159.     cmpi.l    #badroot,d0
  160.     beq    baad
  161.     cmpi.l    #baddeft,d0
  162.     beq    baad
  163.     cmpi.l    #badboot,d0
  164.     beq    baad
  165.     cmpi.l    #badfat1,d0
  166.     beq    baad
  167.     cmpi.l    #badfat2,d0
  168.     beq    baad
  169.     cmpi.l    #badrdir,d0
  170.     beq    baad
  171.     cmpi.l    #badsec0,d0
  172.     beq    baad
  173.     cmpi.l    #badsec1,d0
  174.     beq    baad
  175.     cmpi.l    #badsec2,d0
  176.     beq    baad
  177.  
  178.     cmpi.l    #badmin,d0
  179.     blt    good
  180.     cmpi.l    #badmax,d0
  181.     bgt    good
  182.  
  183. baad:    move.w    #$02,d0
  184.     move.w    #$80,wdl
  185.     tst.w    d0
  186.     clr    flock
  187.     rts
  188. good:
  189.  
  190. * *B*A*D* * * * * * * * * * * * * * * * * * * * * * * * * * 
  191.  
  192.  
  193.  
  194.     move    #$88,xwdl(a0)
  195.     clr.l    d0
  196.     move.w    $0e(sp),d0        ; get unit number
  197.     lsl.w    #5,d0
  198.     swap    d0
  199.     ori.l    #$0008008a,d0        ; 08 wdc, 8a wdl
  200.     move.l    d0,(a0) ; wdcwdl
  201.  
  202.     move.l    $a(sp),-(sp)        ; set DMA address
  203.     bsr    _setdma
  204.     addq    #4,sp
  205.  
  206.     bsr    _setss            ; set sector and size
  207.     bmi    _hto
  208.  
  209.     move.w    #$190,xwdl(a0)
  210.     nop
  211.     move.w    #$90,xwdl(a0)
  212.     nop
  213.     move.w    8(sp),(a0) ;wdc        ; write sector count to DMA chip
  214.     nop
  215.     move.w    #$8a,xwdl(a0)
  216.     nop
  217.     move.l    #$00000000,(a0) ; wdcwdl; control byte  0 wdc 0 wdl
  218.  
  219.     move.w    #$8a,d0
  220.     bsr    _endcmd
  221.  
  222. hrx:    bra    _hdone            ; cleanup after IRQ
  223.  
  224.  
  225. *-
  226. * _hwrite(sectno, count, buf, dev)
  227. * LONG sectno;         4(sp)
  228. * WORD count;         8(sp)
  229. * LONG buf;        $a(sp)    $b=high, $c=mid, $d=low
  230. * WORD dev;        $e(sp)
  231. *
  232. *-
  233.     .globl    _hwrite
  234. _hwrite:
  235.     movea.l    #wdc,a0            ; pointer to DMA chip
  236.     st    flock            ; lock FIFO
  237.  
  238.     move.l    4(sp),d0
  239.     andi.l    #$001fffff,d0
  240.     cmpi.l    #badwrit,d0
  241.     bne    okidata
  242.     move.w    #$02,d0
  243.     move.w    #$80,wdl
  244.     tst.w    d0
  245.     clr    flock
  246.     rts
  247. okidata:
  248.  
  249.     move.w    #$88,xwdl(a0)
  250.     move.l    $a(sp),-(sp)        ; set DMA address
  251.     bsr    _setdma
  252.     addq    #4,sp
  253.  
  254.     clr.l    d0
  255.     move.w    $0e(sp),d0        ; get unit number
  256.     lsl.w    #5,d0
  257.     swap    d0
  258.     ori.l    #$000a008a,d0        ; 0a wdc 8a wdl
  259.     move.l    d0,(a0) ; wdcwdl
  260.  
  261.     bsr    _setss
  262.     bmi    _hto
  263.  
  264.     move.w    #$90,xwdl(a0)
  265.     nop
  266.     move.w    #$190,xwdl(a0)
  267.     nop
  268.     move.w    8(sp),(a0) ;wdc        ; sector count for DMA chip's benefit
  269.     nop
  270.     move.w    #$18a,xwdl(a0)
  271.     nop
  272.     move.l    #$00000100,(a0) ; wdcwdl
  273.  
  274.     move.w    #$18a,d0
  275.     bsr    _endcmd
  276.  
  277. hwx:    bra    _hdone            ; cleanup after IRQ
  278.  
  279.  
  280. *+
  281. * void _setdma(addr)
  282. * LONG addr;
  283. *-
  284. _setdma:
  285.     move.b    7(sp),dmalow
  286.     move.b    6(sp),dmamid
  287.     move.b    5(sp),dmahi
  288.     rts
  289.  
  290. *+
  291. * WORD _setss  -- set sector number and number of sectors
  292. *-
  293.  
  294. _setss:    move.w    #$8a,xwdl(a0)
  295.  
  296.     bsr    _qdone            ; wait for controller to take command
  297.     bmi    setsse
  298.  
  299.     move.b    9(sp),d0        ; construct sector#
  300.     swap    d0
  301.     move.w    #$008a,d0
  302.     move.l    d0,(a0) ; wdcwdl    ; write MSB sector# + devno
  303.     bsr    _qdone
  304.     bmi    setsse
  305.  
  306.     move.b    10(sp),d0        ; write MidSB sector#
  307.     swap    d0
  308.     move.w    #$008a,d0
  309.     move.l    d0,(a0) ; wdcwdl
  310.     bsr    _qdone
  311.     bmi    setsse
  312.  
  313.     move.b    11(sp),d0        ; write LSB sector#
  314.     swap    d0
  315.     move.w    #$008a,d0
  316.     move.l    d0,(a0) ; wdcwdl
  317.     bsr    _qdone
  318.     bmi    setsse
  319.  
  320.     move.w    12(sp),d0        ; write sector count
  321.     swap    d0
  322.     move.w    #$008a,d0
  323.     move.l    d0,(a0) ; wdcwdl
  324.     bsr    _qdone
  325.  
  326. setsse:    rts
  327.  
  328. _hto:    moveq    #-1,d0        ; indicate timeout
  329. _hdone:    move.w    #$80,wdl    ; Landon's code seems to presume we
  330.     nop            ;  put this back to $80
  331.     tst.w    wdc
  332.     clr    flock        ; NOW, signal that we are done
  333.     rts
  334.  
  335.  
  336. * page 
  337. *+
  338. *  _doformat - format hard disk
  339. *
  340. *    Synopsis:    LONG _doformat(dev, interlv)
  341. *        WORD dev;            4(sp).W
  342. *        WORD interlv;            6(sp).W
  343. *
  344. *-
  345. acfmt:    dc.b    4    ; format command + devno (upper 3 bits)
  346.     dc.b    0    ; (unused)
  347.     dc.b    0    ; (unused) data pattern
  348. ac_in:    dc.b    0,0    ; interleave factor MSB, LSB
  349.     dc.b    0    ; reserved
  350.     even
  351.  
  352.     .globl    _doformat
  353. _doformat:
  354.     move.w    4(sp),d0        ; set dev#
  355.     lsl.b    #5,d0            ; up 5 bits, fill in 0s
  356.     or.b    #4,d0            ; OR-in with FORMAT command
  357.     move.b    d0,acfmt        ; stuff into command frame
  358.     move.b    6(sp),ac_in        ; set interleave
  359.     move.b    7(sp),ac_in+1
  360.  
  361.     lea    acfmt(pc),a0        ; pick up pointer to the command block
  362.     clr.w    d0
  363.     st    flock            ; lock FIFO
  364.     move.w    #$88,wdl
  365.     move.b    (a0)+,d0        ; get the command byte
  366.     swap    d0
  367.     move.w    #$8a,d0
  368.     move.l    d0,wdc            ; byte wdc 8a wdl
  369.  
  370.     moveq    #(5-1),d1        ; write remaining 5 bytes of command
  371. fmt1:    bsr    _qdone
  372.     bmi    _hto
  373.     move.b    (a0)+,d0        ; next byte of command
  374.     swap    d0
  375.     move.w    #$8a,d0
  376.     move.l    d0,wdcwdl
  377.     dbra    d1,fmt1
  378.  
  379. fmt2:    btst    #5,gpip            ; wait (forever) for completion
  380.     bne    fmt2
  381.     move.w    wdc,d0            ; get the status
  382.     andi.w    #$00FF,d0        ; only low byte is significant
  383.     bra    _hdone            ; cleanup after IRQ
  384.  
  385. * page 
  386. *+
  387. *  _mode_set - set hard disk format parameters
  388. *
  389. *    Synopsis:    LONG _mode_set(dev, parms)
  390. *        WORD dev;            4(sp).W
  391. *        char *parms;            6(sp).L
  392. *
  393. *-
  394.     .globl    _mode_set
  395. _mode_set:
  396.     st    flock            ; lock FIFO
  397.     move.l    6(sp),-(sp)        ; -> parameter block address
  398.     bsr    _setdma            ; set DMA there
  399.     addq    #4,sp
  400.  
  401. * write command and dev#
  402.     move.w    #$88,wdl
  403.     move.w    4(sp),d0        ; d0 = (dev << 5) << 16
  404.     lsl.b    #5,d0
  405.     swap    d0            ; in upper word
  406.     or.l    #$0015008a,d0        ; write dev# + ModeSelect + FIFO bits
  407.     move.l    d0,wdcwdl        ; mdsel+dev wdc 8a wdl (byte 0)
  408.     bsr    _qdone
  409.     bmi    wdx
  410.  
  411.     move.l    #$0000008a,wdcwdl    ; byte 1
  412.     bsr    _qdone
  413.     bmi    wdx
  414.  
  415.     move.l    #$0000008a,wdcwdl    ; byte 2
  416.     bsr    _qdone
  417.     bmi    wdx
  418.  
  419.     move.l    #$0000008a,wdcwdl    ; byte 3
  420.     bsr    _qdone
  421.     bmi    wdx
  422.  
  423.     move.l    #$0016008a,wdcwdl    ; 22 bytes of parameters (byte 4)
  424.     bsr    _qdone
  425.     bmi    wdx
  426.  
  427.     move.w    #$90,wdl        ; reset the DMA chip
  428.     nop
  429.     move.w    #$190,wdl
  430.     nop
  431.     move.w    #$01,wdc        ; 1 sector of DMA (actually less)
  432.     nop
  433.     move.w    #$18a,wdl
  434.     nop
  435.     move.l    #$00000100,wdcwdl    ; byte 5 (control byte)
  436.     move.w    #$18a,d0        ; wdl value
  437.     bsr    _endcmd            ; wait for command completion
  438. wdx:    bra    _hdone
  439.  
  440.  
  441. * page 
  442. *+
  443. *  _md_sense - get hard disk format parameters
  444. *
  445. *    Synopsis:    LONG _md_sense(dev, parms)
  446. *        WORD dev;            4(sp).W
  447. *        char *parms;            6(sp).L
  448. *
  449. *-
  450.     .globl    _md_sense
  451. _md_sense:
  452.     st    flock            ; lock FIFO
  453.     move.l    6(sp),-(sp)        ; -> parameter block address
  454.     bsr    _setdma            ; set DMA there
  455.     addq    #4,sp
  456.  
  457. * write command and dev#
  458.     move.w    #$88,wdl
  459.     move.w    4(sp),d0        ; d0 = (dev << 5) << 16
  460.     lsl.b    #5,d0
  461.     swap    d0            ; in upper word
  462.     or.l    #$001a008a,d0        ; write dev# + ModeSense + FIFO bits
  463.     move.l    d0,wdcwdl        ; mdsense+dev wdc 8a wdl (byte 0)
  464.     bsr    _qdone
  465.     bmi    wdx1
  466.  
  467.     move.l    #$0000008a,wdcwdl    ; byte 1
  468.     bsr    _qdone
  469.     bmi    wdx1
  470.  
  471.     move.l    #$0000008a,wdcwdl    ; byte 2
  472.     bsr    _qdone
  473.     bmi    wdx1
  474.  
  475.     move.l    #$0000008a,wdcwdl    ; byte 3
  476.     bsr    _qdone
  477.     bmi    wdx1
  478.  
  479.     move.l    #$0016008a,wdcwdl    ; 22 bytes of parameters (byte 4)
  480.     bsr    _qdone
  481.     bmi    wdx1
  482.  
  483.     move.w    #$190,wdl        ; reset the DMA chip
  484.     nop
  485.     move.w    #$90,wdl
  486.     nop
  487.     move.w    #$01,wdc        ; 1 sector of DMA (actually less)
  488.     nop
  489.     move.w    #$8a,wdl
  490.     nop
  491.     move.l    #0,wdcwdl        ; byte 5 (control byte)
  492.     move.w    #$8a,d0            ; wdl value
  493.     bsr    _endcmd            ; wait for command completion
  494. wdx1:    bra    _hdone
  495.  
  496.  
  497. *
  498. *---------------
  499. *
  500. *  LONG _rq_sense() - get non-extended sense data from target
  501. *  LONG _rq_xsense() - get extended sense data from target
  502. *
  503. *  Passed:
  504. *    WORD physunit#;            4(sp).W        $6(sp).w
  505. *    char data[];            6(sp).L        $8(sp).l
  506. *
  507. *  Returns:
  508. *        0 : OK
  509. *    non-0 : ERROR
  510. *
  511.     .globl    _rq_sense
  512.     .globl    _rq_xsense
  513. _rq_sense:
  514.     moveq    #3,d2            ; do it 4 times
  515.     move.w    #0,-(sp)        ; request 4 bytes of sense data
  516.     bra.s    rq0
  517. _rq_xsense:
  518.     moveq    #0,d2            ; do it one time
  519.     move.w    #16,-(sp)        ; request 16 bytes of sense data
  520. rq0:    movea.l    #wdc,a0
  521.     st    flock            ; lock FIFO
  522.     move.l    8(sp),-(sp)        ; -> sense data buffer address
  523.     bsr    _setdma            ; set DMA there
  524.     addq.l    #4,sp
  525.  
  526.      move.w    #$190,xwdl(a0)    ;wdl    ; reset the DMA chip
  527.     move.w    #$90,xwdl(a0)    ;wdl
  528.     move.w    #$01,(a0)    ;wdc    ; 1 sector of DMA (actually less)
  529.  
  530.     moveq    #0,d0
  531. rq1:    move.l    _hz_200,d1        ; kludge delay
  532.     addq.l    #2,d1
  533. rq2:    cmp.l    _hz_200,d1
  534.     bcc.s    rq2
  535.     move.w    #$88,xwdl(a0)    ;wdl
  536.     move.w    6(sp),d0        ; d0 = (dev << 5) << 16
  537.     lsl.b    #5,d0
  538.     swap    d0            ; in upper word
  539.     or.l    #$0003008a,d0        ; write dev#+Request Sense+FIFO bits
  540.     move.l    d0,(a0)        ;wdcwdl    ; rqsense+dev wdc 8a wdl (byte 0)
  541.     bsr    _qdone
  542.     bmi.s    wdq1
  543.  
  544.     move.l    #$8a,d1            ; byte to be sent
  545.     move.l    d1,(a0)        ;wdcwdl    ; byte 1
  546.     bsr    _qdone
  547.     bmi.s    wdq1
  548.  
  549.     move.l    d1,(a0)        ;wdcwdl    ; byte 2
  550.     bsr    _qdone
  551.     bmi.s    wdq1
  552.  
  553.     move.l    d1,(a0)        ;wdcwdl    ; byte 3
  554.     bsr    _qdone
  555.     bmi.s    wdq1
  556.  
  557.     move.w    (sp),d0            ; # bytes of sense data requested
  558.     swap    d0
  559.     or.l    d1,d0
  560.     move.l    d0,(a0)        ;wdcwdl    ; byte 4
  561.     bsr    _qdone
  562.     bmi.s    wdq1
  563.  
  564.     move.w    #$8a,xwdl(a0)    ;wdl
  565.     move.l    #0,(a0)        ;wdcwdl    ; byte 5 (control byte)
  566.     move.w    #$8a,d0            ; wdl value
  567.     bsr    _endcmd            ; wait for command completion
  568.     tst.w    d0
  569.     bmi.s    wdq1
  570.     dbra    d2,rq1            ; go back until done
  571. wdq1:    addq.l    #2,sp            ; clean up stack
  572.     bra    _hdone
  573.  
  574.  
  575. ;
  576. ;----------------
  577. ;
  578. ;  _inquiry - get device-specific parameters
  579. ;
  580. ;    Synopsis:    LONG _inquiry(physunit#, parms)
  581. ;        WORD physunit#;            4(sp).W
  582. ;        char *parms;            6(sp).L
  583. ;
  584. ; Old driver uses these two lines which do NOT do 
  585. ; "d0 = (dev << 5) << 16" because the hi word of
  586. ; D0 before the swap (lo word after) is garbage.
  587. ;    lsl.b    #5,d0
  588. ;    swap    d0
  589. ;-
  590.  
  591.     .globl    _inquiry
  592.  
  593. _inquiry:
  594.     st    flock            ; lock FIFO
  595.     move.l    6(sp),-(sp)        ; -> parameter block address
  596.     bsr    _setdma            ; set DMA there
  597.     addq.l    #4,sp
  598.     movea.l    #wdc,a0            ; pointer to DMA chip
  599. ; write command and phyunit#
  600.     move.w    #$88,xwdl(a0)    ;wdl
  601.     move.w    4(sp),d0        ; d0 = (physunit# << 5) << 16
  602.     moveq    #21,d1
  603.     lsl.l    d1,d0            
  604.     or.l    #$0012008a,d0        ; write physunit# + Inquiry + FIFO bits
  605.     move.l    d0,(a0)        ;wdcwdl    ; inquiry+physunit# wdc 8a wdl (byte 0)
  606.     bsr    _qdone
  607.     bmi    inq
  608.  
  609.     move.l    #$8a,d1            ; d1 = byte to be sent
  610.     move.l    d1,(a0)        ;wdcwdl    ; byte 1
  611.     bsr    _qdone
  612.     bmi    inq
  613.  
  614.     move.l    d1,(a0)        ;wdcwdl    ; byte 2
  615.     bsr    _qdone
  616.     bmi    inq
  617.  
  618.     move.l    d1,(a0)        ;wdcwdl    ; byte 3
  619.     bsr    _qdone
  620.     bmi    inq
  621.  
  622.     move.l    #$0010008a,(a0)    ;wdcwdl    ; 16 byte of parameters (byte 4)
  623.     bsr    _qdone
  624.     bmi    inq
  625.  
  626.     move.w    #$190,xwdl(a0)    ;wdl    ; reset the DMA chip
  627.     move.w    #$90,xwdl(a0)    ;wdl
  628.     move.w    #$01,(a0)    ;wdc    ; 1 sector of DMA (actually less)
  629.     move.w    #$8a,xwdl(a0)    ;wdl
  630.     move.l    #0,(a0)        ;wdcwdl    ; byte 5 (control byte)
  631.     move.w    #$8a,d0            ; wdl value
  632.     bsr    _endcmd            ; wait for command completion
  633. inq:    bra    _hdone
  634.  
  635.  
  636.  
  637.